using System;
using System.Collections.Generic;
using System.Text;

namespace Mud.Server.Physical
{

    /// <summary>
    /// Abstract class for events where the source of the event is an object.
    /// </summary>
    public abstract class SimpleObjectEvent : PhysicalEvent
    {

        /// <summary>
        /// Source of the event.
        /// </summary>
        public SimpleObject Source
        {
            get { return _source; }
            set { _source = value; }
        }
        private SimpleObject _source;


        public SimpleObjectEvent(SimpleObject o) : base(o.Location)
        {
            if (o == null)
                throw new ArgumentNullException("o");
            _source = o;
        }
    }

    /// <summary>
    /// Event which is raised when an object becomes detectable to some creature.
    /// </summary>
    public sealed class EventSimpleObjectAppeared : SimpleObjectEvent
    {

        public EventSimpleObjectAppeared(SimpleObject o)
            : base(o)
        {
        }

        public override void Send(IPhysicalEventReceiver receiver) { receiver.Receive(this); }

    }

    /// <summary>
    /// Event which is raised when a creature becomes undetectable to some other creature.
    /// </summary>
    public sealed class EventSimpleObjectDisappeared : SimpleObjectEvent
    {

        public EventSimpleObjectDisappeared(SimpleObject o)
            : base(o)
        {
        }

        public override void Send(IPhysicalEventReceiver receiver) { receiver.Receive(this); }

    }
}
